<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <h1>管理员页面</h1>
        <input id="msg"/>
        <button id="btn">发送标题</button>
        <button id="clos">关闭直播</button>
    </div>
</body>
<script>
    let msgInput = document.getElementById("msg");
    let btnInput = document.getElementById("btn");
    let closeBtn = document.getElementById("clos");
   let  ws = new WebSocket("ws://192.168.50.107:8080")

    btnInput.onclick = function(){//绑定点击事件
        let msg  = msgInput.value;
        ws.send(JSON.stringify({
            nickName:"管理员",
            msg,
            type:2
        }))

    }
    closeBtn.onclick = function(){
        ws.send(JSON.stringify({
            nickName:"管理员",
            msg:"",
            type:3
        })) 
    }


</script>

</html>